class Person{
    constructor(_id,_name,_age){
        this.id = _id ;
        this.name = _name ;
        this.age = _age ;
    }
    introduce(){
        return `My name is ${this.name}. I am ${this.age} years old.` ;
    }
}
module.exports = Person ;
class Class{
    constructor(_number){
        this.number = _number ;
    }
    getDisplayName(){
        return `Class ${this.number}` ;
    }
    assignLeader(_student){
        //该学生是否为本班的
        if(_student.klass.number === this.number){
            this.leader = _student ;
        }else{
            console.log(`It is not one of us.`);
        }
        return 0 ;
    }
    appendMember(_student){
        _student.klass.number = this.number ;
        return 0 ;
    }
}
class Student extends Person{
    constructor(_id,_name,_age,_klass){
        super(_id,_name,_age);
        this.klass = _klass ;
    }
    introduce(){
        if(this.klass.leader.id === this.id){
            return super.introduce() + ` I am a Student. I am Leader of Class ${this.klass.number}.` ;
        }else{
            return super.introduce() + ` I am a Student. I am at Class ${this.klass.number}.` ;
        }
    }
}
// let k1 = new Class(1);
// let s1 = new Student(2,"zhuzi",18,k1);
// let s2 = new Student(3,"zhanghang",19,k1);
// k1.assignLeader(s1);
// console.log(k1);
// console.log(s1.introduce());
// console.log(s2.introduce());
// const klass = new Class(2);
// const otherKlass = new Class(3);
// const student = new Student(1, "Jerry", 21, otherKlass);


// console.log(student.klass);
// console.log(otherKlass);
// klass.appendMember(student);
// console.log(student.klass);
// console.log(klass);
